package com.kn.sys.controller;

import com.kn.common.model.R;
import com.kn.sys.dto.UserRole;
import com.kn.sys.service.UserRoleService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhoudf
 * @create 2021-03-09 15:37
 */
@RestController
@RequestMapping("sys/userRole")
@CrossOrigin
@RequiredArgsConstructor
public class UserRoleController {
    private final UserRoleService userRoleService;
    @PostMapping("/userid/{userId}/roleNames/{roleNames}")
    public R saveByUserId(@PathVariable long userId, @PathVariable String roleNames, @RequestBody UserRole[] userRoles){
        return userRoleService.saveByUserId(userId,roleNames,userRoles);
    }
}
